package com.hptpd.questionnairesurvey.repository;

import com.hptpd.questionnairesurvey.domain.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * \* Created with IntelliJ IDEA.
 * \* Date: 2019-07-16 09:15
 * \*
 * \* Description:
 * \
 *
 * @author waiterlong
 */
@Repository("userRep")
public interface UserRep extends JpaRepository<User, String> {
    /**
     * 根据ID集合找users
     * @param ids List<String>
     * @return List<User>
     */
    List<User> findByIdIn(List<String> ids);

    /**
     * 根据openId找User
     * @param openId String
     * @return User
     */
    User findByWeChatOpenId(String openId);

    /**
     * 根据phone找User
     * @param phone String
     * @return User
     */
    User findByPhone(String phone);

    List<User> findByPhoneLike(String phone);

    List<User> findByRealNameIsAndDepartment_ParentDepartment_NameIs(String name, String name1);
}
